package com.spdzen.support;

import java.io.Serializable;

/**
 * 键值对
 * @author accountwcx@qq.com
 *
 * @param <K>
 * @param <V>
 */
public class KeyValuePair<K, V> implements Serializable {
	private static final long serialVersionUID = 8657166080665052883L;

	private K key;
	private V value;

	public KeyValuePair() {
	}

	public KeyValuePair(K key, V value) {
		this.key = key;
		this.value = value;
	}

	public K getKey() {
		return key;
	}

	public void setKey(K key) {
		this.key = key;
	}

	public V getValue() {
		return value;
	}

	public void setValue(V value) {
		this.value = value;
	}

	@Override
	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append("[key=");

		if (key != null) {
			sb.append(key.toString());
		} else {
			sb.append("null");
		}

		sb.append(",value=");

		if (value != null) {
			sb.append(value.toString());
		} else {
			sb.append("null");
		}

		sb.append("]");

		return sb.toString();
	}
}
